# ##############################################################################
# drivers/CMakeLists.txt
#
# Copyright (c) 2025 Li Auto Inc. and its affiliates
# Licensed under the Apache License, Version 2.0(the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ##############################################################################
set(ETH_STACK_PHYRTL8211F_DIR "${CMAKE_CURRENT_SOURCE_DIR}/8211f/" CACHE PATH "Path from drivers/Phy_Rtl8211f")

set(ETHPHY_INC)
set(ETHPHY_SRC)

list(APPEND ETHPHY_INC
    ${CMAKE_CURRENT_LIST_DIR}/../../../../include/autosar
)

if(CONFIG_PHY_RTL8211F)
    nuttx_add_library(eth_gethphy STATIC)

    list(APPEND ETHPHY_INC
        ${ETH_STACK_PHYRTL8211F_DIR}
        ${VENDOR_THIRD_PARTY_DRIVER_INCDIR}
    )

    file(GLOB_RECURSE PHY_SRC_PATH
        ${ETH_STACK_PHYRTL8211F_DIR}/*.c
    )
    list(APPEND ETHPHY_SRC
        ${PHY_SRC_PATH}
    )

    target_include_directories(eth_gethphy PUBLIC ${ETHPHY_INC})
    target_sources(eth_gethphy PUBLIC ${ETHPHY_SRC})

endif()

